package cn.icanci.test.postprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.Configuration;

/**
 * bean 创建的前置处理器和后置处理器
 * @author icanci
 * @date Created in 2021/02/18 22:55
 * @version 1.0
 */
@Configuration
public class CustomizedBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("CustomizedBeanPostProcessor.postProcessBeforeInitialization beanName : " + beanName);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("CustomizedBeanPostProcessor.postProcessAfterInitialization beanName : " + beanName);
        return bean;
    }
}
